<%@ page language="java" contentType="text/xml; charset=UTF-8" pageEncoding="UTF-8"  trimDirectiveWhitespaces="true" session="false" %>
<%@include file="../include/taglibs.jsp"%>
<%@include file="../include/urls.jsp"%>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<games from="${fn:escapeXml(from)}" to="${fn:escapeXml(to)}">
	<link rel="self" href="${gamesUrl}?from=${from}&amp;to=${to}" />
	<c:if test="${prevFrom >= 0 && prevTo >= 0}">
	<link rel="prev" href="${gamesUrl}?from=${prevFrom}&amp;to=${prevTo}" />
	</c:if>
	<c:if test="${nextFrom >= 0 && nextTo >= 0}">
	<link rel="next" href="${gamessUrl}?from=${nextFrom}&amp;to=${nextTo}" />
	</c:if>
	<c:forEach var="game" items="${games}">
	<game>
		<link rel="self" href="${gamesUrl}${game.id}" />
		<id>${game.id}</id> 
		<title>${game.title}</title>
		<creationTime>${game.creationTime}</creationTime>
		<owner>
			<link rel="self" href="${playersUrl}${game.owner.name}" />
			<name>${game.owner.name}</name>
		</owner>
		<c:if test="${game.winner != null}">  
		<winner>
			<link rel="self" href="${playersUrl}${game.winner.name}" />
			<name>${game.winner.name}</name>
		</winner>
		</c:if>
	</game>
	</c:forEach>
</games>
